package com.lq.ecoldchain.ui.main.home

import com.lq.ecoldchain.base.CommonLoadingViewModel
import org.kodein.di.Kodein
import org.kodein.di.android.support.AndroidLifecycleScope
import org.kodein.di.generic.bind
import org.kodein.di.generic.instance
import org.kodein.di.generic.scoped
import org.kodein.di.generic.singleton

/*
*2018/12/24 0024  19:23
*function by lq
*/
const val HOME_KODEIN_MODULE = "home_kodein_module"
val homeKodeinModule = Kodein.Module(HOME_KODEIN_MODULE) {

    bind<HomeViewModel>() with scoped(AndroidLifecycleScope).singleton {
        HomeViewModel()
    }

    bind<HomeDelegate>() with scoped(AndroidLifecycleScope).singleton {
        HomeDelegate(
                viewModel = instance(),
                loadingViewModel = CommonLoadingViewModel.instance(context)
        )
    }
}